package com.itheima.demo03;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class MainClass02 {
    public static void main(String[] args) {
        LocalDateTime now = LocalDateTime.now();
        System.out.println(now);
        System.out.println("------------------------");
        LocalDateTime dateTime = LocalDateTime.of(2020, 7, 12, 16, 16, 30);
        System.out.println(dateTime);
        DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH:mm:ss");
        String s = dateTime.format(pattern);
        System.out.println(s);
        System.out.println("--------------------------");
        LocalDateTime dateTime1 = LocalDateTime.parse(s, pattern);
        System.out.println(dateTime1);
    }
}
